package com.lyl.common.validation.annotation;


import com.lyl.common.validation.validator.ListDigitConstraintValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * @author 罗亚龙
 * @date 2021/8/27 9:22
 * 自定义校验注解
 */

//自定义校验约束器
@Constraint(validatedBy = {ListDigitConstraintValidator.class})
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface ListDigit {

    //配置文件中错误提示信息的名称
    String message() default "只能为指定值{value}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    //自定义值的类型
    int[] value();

    //必须
    boolean required() default true;
}
